package com.concerneyes.titleView.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.concerneyes.R;

/**
 * Created by Administrator on 2017/7/1 0001.
 */

public class msgAdapter extends BaseAdapter {
    private Context context;

    public msgAdapter(Context context) {
        this.context = context;
    }

    @Override
    public int getCount() {
        return 2;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if (convertView == null){
            holder = new ViewHolder();
            convertView = LayoutInflater.from(context).inflate(R.layout.item_msg, null);
            holder.mIvMsg = (ImageView) convertView.findViewById(R.id.iv_msg);
            holder.mTvMsgTitle = (TextView) convertView.findViewById(R.id.tv_msg_title);
            holder.mTvMsgTime = (TextView) convertView.findViewById(R.id.tv_msg_time);
            holder.mTvMsgInfo = (TextView) convertView.findViewById(R.id.tv_msg_info);
            convertView.setTag(holder);
        }else {
            holder =(ViewHolder) convertView.getTag();
        }

        return convertView;
    }

    class ViewHolder {
        ImageView mIvMsg;
        TextView mTvMsgTitle;
        TextView mTvMsgTime;
        TextView mTvMsgInfo;
    }
}
